<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>拼团管理</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/detail.css" />
</head>
<body>
<div class="detail" id="one">
  <form action="__MODULE__/FarmerSpellgroup/upd/" enctype="multipart/form-data" method="post">
    <div class="form">
      <ul>
        <input name="id" value="{$shop.id}" type="hidden">
        <input name="dowhat" value="{$shop.dowhat}" type="hidden">
        <li><span>商品标题</span>
          <input name="title" value="{$shop.title}" type="text" placeholder="请输入标题" style="width:75%;" required/>
        </li>
        <li><a onClick="show(2)"><span>商品主图</span><em></em></a></li>
        <li><span>商品库存</span>
          <input name="num" type="number" placeholder="请输入库存(份)" value="{$shop.num}" required/>
          <span>份</span></li>
        <li><span>出货报价</span>
          <input name="wholesale" type="number" placeholder="请输入库存(份)" value="{$shop.wholesale}"  step="0.01" required/>
          <span>元</span></li>
        <volist name="shop['price_range']" id="vo">
        <li class="interval">
          <span>批发区间</span>
          <input name="p_id[]" type="hidden" value="{$vo.id}"><input type="number" name="start[]" value="{$vo.start}"  placeholder="开始份数"/><input type="number" name="end[]" value="{$vo.end}" placeholder="结束份数"/><input type="text" name="p_price[]" value="{$vo.price}" placeholder="价格"/></li>
        </volist>
        <li><span>每份分量</span>
          <input name="u_num" style="margin-left:0" type="number" placeholder="请输入数字" value="{$shop.u_num}" required/>
          <select name="unit">
            <volist name="type" id="vo">
              <option value="{$vo.id}" <eq name="vo.id" value="$shop.unit">selected</eq> >{$vo.title}</option>
            </volist>
          </select>
        </li>
        <!--<li><span>拼团人数</span><input name="000000" type="text" placeholder="请输入拼团人数" style="width:75%;"/></li>-->
        <li class="start"><span>拼团开始时间</span>
          <input name="starttime" value="{$shop.starttime|date="Y-m-d H:i",###}" style="margin-left:0; width:66%;" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"/>
        </li>
        <li class="start"><span>拼团结束时间</span>
          <input name="endtime" value="{$shop.endtime|date="Y-m-d H:i",###}" style="margin-left:0; width:66%;" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"/>
        </li>
        <li style="margin-top:10px;"><a onClick="show(4)"><span>拼团须知</span></a></li>
        <li><a onClick="show(3)"><span>商品详情</span></a></li>
      </ul>
    </div>
    <div class="button">
      <input type="submit" value="立即发布"/>
    </div>
</div>
  <!--页面二-->
  <input type="hidden" name="h_imgs" value="{$shop.h_imgs}">
  <div class="detail" id="two" style="display:none;">
    <div class="upload">
      <ul>
        <li><img src="{$shop.img1}" <eq name="shop.img1" value="">style="display:none;"</eq> width="176" height="172" id="picShow_1" onClick="upimg('1')"/>
          <div class="inner" <neq name="shop.img1" value="">style="display:none;"</neq> > <img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('1')" />
            <input id="img_1" type="file" style="display:none;" type="text" value="{$shop.img1}">
            <h3>上传主图1</h3>
          </div>
        </li>
        <li><img src="{$shop.img2}" <eq name="shop.img2" value="">style="display:none;"</eq> width="176" height="172" id="picShow_2" onClick="upimg('2')"/>
          <div class="inner" <neq name="shop.img2" value="">style="display:none;"</neq> > <img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('2')" />
            <input id="img_2" type="file" style="display:none;" type="text" value="{$shop.img2}">
            <h3>上传主图2</h3>
          </div>
        </li>
        <div class="clear"></div>
      </ul>
    </div>
    <div class="button">
      <input type="button" value="上传" onClick="show(1)"/>
    </div>
  </div>
  <!--页面三-->
  <input type="hidden" name="c_imgs" value="{$shop.c_imgs}">
  <div class="detail" id="three" style="display:none;">
    <div class="upload">
      <ul>
        <li><img src="{$shop.img3}" <eq name="shop.img3" value="">style="display:none;"</eq> width="176" height="172" id="picShow_3" onClick="upimg('3')"/>
          <div class="inner" <neq name="shop.img3" value="">style="display:none;"</neq>"><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('3')"/>
          	<input id="img_3" type="file" style="display:none;" type="text" value="{$shop.img3}">
            <h3>上传详情1</h3>
          </div>
        </li>
        <li><img src="{$shop.img4}" <eq name="shop.img4" value="">style="display:none;"</eq> width="176" height="172" id="picShow_4" onClick="upimg('4')"/>
          <div class="inner" <neq name="shop.img4" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('4')"/>
          	<input id="img_4" type="file" style="display:none;" type="text" value="{$shop.img4}">
            <h3>上传详情2</h3>
          </div>
        </li>
        <li><img src="{$shop.img5}" <eq name="shop.img5" value="">style="display:none;"</eq> width="176" height="172" id="picShow_5" onClick="upimg('5')"/>
          <div class="inner" <neq name="shop.img5" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('5')"/>
          	<input id="img_5" type="file" style="display:none;" type="text" value="{$shop.img5}">
            <h3>上传详情3</h3>
          </div>
        </li>
        <li><img src="{$shop.img6}" <eq name="shop.img6" value="">style="display:none;"</eq> width="176" height="172" id="picShow_6" onClick="upimg('6')"/>
          <div class="inner" <neq name="shop.img6" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('6')"/>
          	<input id="img_6" type="file" style="display:none;" type="text" value="{$shop.img6}">
            <h3>上传详情4</h3>
          </div>
        </li>
        <div class="clear"></div>
      </ul>
    </div>
    <div class="button">
      <input type="button" value="上传" onClick="show(1)"/>
    </div>
  </div>
  <!--页面四-->
  <div class="detail" id="four" style="display:none;">
    <div class="evaluate">
      <div class="writ">
        <textarea name="server">{$shop.server}</textarea>
      </div>
      <div class="anonymity" style="background:#f2f2f2;"><span>
        <input type="radio" />
        使用默认拼团须知</span></div>
    </div>
    <div class="button">
      <input type="button" value="保存提交" onClick="show(1)"/>
    </div>
  </div>
</form>

<!----> 
<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script> 
<script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script> 
<script type="text/javascript">
$(document).ready(function(e) {
	$(".anonymity span").click(function(){
		if($(this).hasClass("select")){
			$(this).removeClass("select");
		}else{
			var con='1.参与拼团，达到拼团人次可成团2.在拼团时间内，已成团可继续参团3.若活动截止时间，还未成团，则拼团失败，退还金额4.活动截止后，根据预定数量，次日商家进货5.到货后，社区店进行打包，新鲜保证。你会收到取货通知及取货码，凭取货码取货';
			$("textarea[name='server']").val(con);
			$(this).addClass("select");
		}
	});
});
</script>

<script type="text/javascript">
	$('.del').click(function(){ 
		$(this).parents('li').css('display','none') 
	});
</script> 
<script type="text/javascript">
<!--上传产品头部两个图片和详情四个图片-->
function show(num){
	$(".detail").css("display","none");
	if(num==1){$("#one").css("display","");}
	if(num==2){$("#two").css("display","");}
	if(num==3){$("#three").css("display","");}
    if(num==4){$("#four").css("display","");}
	//首页图链接拼接
	$("input[name='h_imgs']").val($("#img_1").attr("value")+','+$("#img_2").attr("value"));
	//详情图链接拼接c_imgs
	$("input[name='c_imgs']").val($("#img_3").attr("value")+','+$("#img_4").attr("value")+','+$("#img_5").attr("value")+','+$("#img_6").attr("value"));
}//end fun
//图片上传
function upimg(num) {
	//input file 模拟点击
	if($("#img_"+num).attr("type")!="file")$("#img_"+num).attr("type","file");
	$("#img_"+num).click();
}//end fun
$("#img_1").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_1");
	var domain = 'http://www.xiangtws.com';
	var proportion = '1:1';  //图片比例
	var imgsrc=$("#picShow_1");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_1").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_1").attr("type","text");
			$("#img_1").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_2").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_2");
	var domain = 'http://www.xiangtws.com';
	var proportion = '1:1';  //图片比例
	var imgsrc=$("#picShow_2");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_2").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_2").attr("type","text");
			$("#img_2").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_3").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_3");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_3");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_3").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_3").attr("type","text");
			$("#img_3").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun

$("#img_4").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_4");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_4");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_4").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_4").attr("type","text");
			$("#img_4").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_5").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_5");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_5");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_5").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_5").attr("type","text");
			$("#img_5").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_6").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_6");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_6");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_6").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_6").attr("type","text");
			$("#img_6").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun

</script>
</body>
</html>